package com.qianguo.buyer;

import com.alibaba.fastjson.JSONPath;
import com.alibaba.fastjson.TypeReference;
import com.alibaba.fastjson.asm.Type;
import com.eva.androidlibrary.utils.JsonParser;
import com.qianguo.buyer.entity.BuyerAddress;

import java.util.List;

/**
 * @author eva
 * @date 16/8/18
 */
public class Test {

    public static String json = "[{\"address_id\":7,\"uuid\":\"190ivhr0oi2su\",\"receiver\":\"收货人2\",\"mobile\":\"143\",\"province_id\":123,\"province\":\"上海\",\"poi_id\":222,\"poi_name\":\"学校\",\"address\":\"详细地址2\",\"zipcode\":\"330403\",\"add_type\":3,\"created_at\":1462094598,\"updated_at\":1462094598,\"is_default\":0},{\"address_id\":8,\"uuid\":\"190ivhr0oi2su\",\"receiver\":\"收货人2\",\"mobile\":\"143\",\"province_id\":123,\"province\":\"上海\",\"poi_id\":222,\"poi_name\":\"学校\",\"address\":\"详细地址2\",\"zipcode\":\"330403\",\"add_type\":3,\"created_at\":1462094614,\"updated_at\":1462094614,\"is_default\":0},{\"address_id\":9,\"uuid\":\"190ivhr0oi2su\",\"receiver\":\"收货人2\",\"mobile\":\"143\",\"province_id\":123,\"province\":\"上海\",\"poi_id\":222,\"poi_name\":\"学校\",\"address\":\"详细地址2\",\"zipcode\":\"330403\",\"add_type\":3,\"created_at\":1462094913,\"updated_at\":1462094913,\"is_default\":0},{\"address_id\":10,\"uuid\":\"190ivhr0oi2su\",\"receiver\":\"顾霞\",\"mobile\":\"18016306657\",\"province_id\":0,\"province\":\"\",\"poi_id\":0,\"poi_name\":\"\",\"address\":\"上海市徐汇区凯滨路166号平安大厦B座\",\"zipcode\":\"\",\"add_type\":2,\"created_at\":1471511015,\"updated_at\":1471511015,\"is_default\":0}]";

    public static void main(String... args) {
        TypeReference<List<BuyerAddress>> typeReference = new TypeReference<List<BuyerAddress>>() {};

        List<BuyerAddress> list = JsonParser.parseObject(json, typeReference);

        System.out.println("" + list.size());
    }


}
